<form name="frm" method="post" action="<?php echo $this->site['base_url']?>registers/save">
<table width="98%" border="0" cellspacing="0" cellpadding="0">
     <tr>
    <td  >
    <table class="item" border="0" width="100%" cellpadding="2" cellspacing="2">
      <tr>
        <td colspan="2" class="item_title" ><?php echo Kohana::lang('registers_lang.tt_page')?></td>
        </tr>
	</table>

	</td>
	</tr>
	
	<tr><td>&nbsp;</td></tr>
	<tr><td><strong><?php echo Kohana::lang('library_lang.lbl_public_program')?></strong></td></tr>
	<tr>
    <td style="padding-top:10px" >
		<table width="99%" border="1" cellspacing="0" cellpadding="5" style="border-collapse:collapse">
		  <tr>
			<td colspan="2" class="title_special" ><?php echo Kohana::lang('registers_lang.lbl_program')?></td>
			<td width="23%" class="title_special"><?php echo Kohana::lang('registers_lang.lbl_program_schedule')?></td>
			<td width="11%" class="title_special"><?php echo Kohana::lang('registers_lang.lbl_program_investment')?></td>
		  </tr>
		  <?php foreach($mPrograms as $list){?>
		  <tr>
		    <td width="5%" valign="top"><input name="chk_program[]" type="checkbox" value="<?php if(isset($list['programs_id'])) echo $list['programs_id']?>" /></td>
		    <td width="61%" valign="top"><?php if(isset($list['programs_title'])) echo $list['programs_title']?></td>
		    <td valign="top"><?php if(isset($list['programs_begin_date'])) echo date('d/m/Y',$list['programs_begin_date'])?></td>
		    <td align="right"><?php if(isset($list['programs_investment'])) echo $list['programs_investment'];?></td>
	      </tr>
		  <?php }?>
		 
		</table>

	<td>
	</tr>
	<tr><td>&nbsp;</td></tr>
	<tr><td><strong><?php echo Kohana::lang('library_lang.lbl_program_special')?></strong></td></tr>
	<tr>
    <td  style="padding-top:10px">
		<table width="99%" border="1" cellspacing="0" cellpadding="5" style="border-collapse:collapse">
		  <tr>
		    <td  class="title_special" >&nbsp;</td>
			<td  class="title_special" ><?php echo Kohana::lang('registers_lang.lbl_program')?></td>
			<td  class="title_special" width="34%"><?php echo Kohana::lang('registers_lang.lbl_program_schedule')?></td>
			<td  class="title_special" width="14%"><?php echo Kohana::lang('registers_lang.lbl_program_investment')?></td>
		  </tr>
		  <?php foreach($mProgram as $list_program){?>
		  <tr>
		    <td width="5%" valign="top"><input name="chk_pro[]" type="checkbox" value="<?php if(isset($list_program['programs_id'])) echo $list_program['programs_id']?>" /></td>
		    
		    <td width="47%" valign="top"><?php if(isset($list_program['programs_title'])) echo $list_program['programs_title']?></td>
		    <td valign="top"><?php echo Kohana::lang('registers_lang.lbl_lienhe')?></td>
		    <td valign="top"  align="right"><?php if(isset($list_program['programs_investment'])) echo $list_program['programs_investment'];?></td>
	      </tr>
		  <?php }?>
		</table>

	<td>
	</tr>
	<tr><td>&nbsp;</td></tr>
	<tr><td>
	<table id="tblSample" width="99%" border="1" cellspacing="0" cellpadding="5" style="border-collapse:collapse">
		  <tr>
			<td colspan="2" class="title_special"><?php echo Kohana::lang('registers_lang.lbl_program_student')?></td>
			<td width="16%" align="center" class="title_special"><?php echo Kohana::lang('registers_lang.lbl_gender')?></td>
			<td width="13%" align="center" class="title_special"><?php echo Kohana::lang('registers_lang.lbl_designation')?></td>
			<td width="33%" align="center" class="title_special"><?php echo Kohana::lang('registers_lang.lbl_your_email')?></td>
		  </tr>
		  <tr>
		    <td><div align="left">1</div></td>
		    <td>
		      <input type="text" name="txt_name[]"  size="30"/>
		    </td>
		    <td align="left">
		      <select name="selGender[]">
			  <option value="<?php echo Kohana::lang('registers_lang.lbl_male')?>"><?php echo Kohana::lang('registers_lang.lbl_male')?></option>
			  <option  value="<?php echo Kohana::lang('registers_lang.lbl_female')?>"><?php echo Kohana::lang('registers_lang.lbl_female')?></option>
			  </select>
		    </td>
		    <td><input type="text" name="txt_designation[]"  size="10"/></td>
		    <td><input type="text" name="txt_email[]"  size="30"/></td>
	      </tr>
		  <tr>
		    <td><div align="left">2</div></td>
		    <td><input type="text" name="txt_name[]"  size="30"/></td>
		    <td align="left"><select name="selGender[]">
			  <option value=""><?php echo Kohana::lang('registers_lang.lbl_male')?></option>
			  <option  value=""><?php echo Kohana::lang('registers_lang.lbl_female')?></option>
		    </select></td>
		    <td><input type="text" name="txt_designation[]"  size="10"/></td>
		    <td><input type="text" name="txt_email[]"  size="30"/></td>
	      </tr>
		  <tr>
		    <td><div align="left">3</div></td>
		    <td><input type="text" name="txt_name[]"  size="30"/></td>
		    <td align="left"><select name="selGender[]">
			  <option value=""><?php echo Kohana::lang('registers_lang.lbl_male')?></option>
			  <option  value=""><?php echo Kohana::lang('registers_lang.lbl_female')?></option>
		    </select></td>
		    <td><input type="text" name="txt_designation[]"  size="10"/></td>
		    <td><input type="text" name="txt_email[]"  size="30"/></td>
	      </tr>
		  <tr>
			<td width="4%"><div align="left">4</div></td>
			<td width="34%"><input type="text" name="txt_name[]"  size="30"/></td>
			<td align="left"><select name="selGender[]">
			  <option value=""><?php echo Kohana::lang('registers_lang.lbl_male')?></option>
			  <option  value=""><?php echo Kohana::lang('registers_lang.lbl_female')?></option>
		    </select></td>
			<td><input type="text" name="txt_designation[]"  size="10"/></td>
			<td><input type="text" name="txt_email[]"  size="30"/></td>
		  </tr>
		 
		</table>

	</td></tr>
	<tr><td align="left">
	<input type="button" onclick="addRowToTable();" value="<?php echo Kohana::lang('registers_lang.lbl_add_row')?>" />
	</td></tr>
	<tr><td>
	<table width="100%" border="0" cellspacing="0" cellpadding="2">
	  <tr>
      	<td height="20px;"></td>
      </tr>
      <tr>
		<td colspan="2"><strong><?php echo Kohana::lang('registers_lang.lbl_dieukhoan')?></strong></td>
		</tr>
	  <tr>
		<td width="5%" align="center">1.</td>
		<td width="95%"><?php echo Kohana::lang('registers_lang.lbl_dieukhoan1')?></td>
	  </tr>
	  <tr>
		<td align="center">2.</td>
		<td><?php echo Kohana::lang('registers_lang.lbl_dieukhoan2')?></td>
	  </tr>
	  <tr>
		<td align="center">3.</td>
		<td><?php echo Kohana::lang('registers_lang.lbl_dieukhoan3')?></td>
	  </tr>
	  <tr>
		<td align="center" valign="top">4.</td>
		<td><?php echo Kohana::lang('registers_lang.lbl_dieukhoan4')?><br>
		
		<li><?php echo Kohana::lang('registers_lang.lbl_dieukhoan5')?></li>
		<li><?php echo Kohana::lang('registers_lang.lbl_dieukhoan6')?></li>
		
		
		</td>
	  </tr>
	</table>

	</td></tr>
	<tr><td>
	<table width="100%" border="0" cellspacing="0" cellpadding="2">
  <tr>
    <td width="21%">&nbsp;</td>
    <td width="34%">&nbsp;</td>
    <td width="45%">&nbsp;</td>
  </tr>
  <tr>
    <td colspan="2"><strong><?php echo Kohana::lang('registers_lang.lbl_program_info_company')?></strong></td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td><?php echo Kohana::lang('registers_lang.lbl_organization')?></td>
    <td><input type="text" name="txt_organization"  size="40"/></td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td><?php echo Kohana::lang('registers_lang.lbl_street_address')?></td>
    <td><input type="text" name="txt_address"  size="40"/></td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td><?php echo Kohana::lang('registers_lang.lbl_phone')?></td>
    <td><input type="text" name="txt_phone"  size="40"/></td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
   <tr>
    <td colspan="2"><strong><?php echo Kohana::lang('registers_lang.lbl_program_dieukhoan')?></strong></td>
    <td>&nbsp;</td>
  </tr>
 
  <tr>
    <td><?php echo Kohana::lang('registers_lang.lbl_program_giamdoc')?></td>
    <td><input type="text" name="txt_giamdoc"  size="40"/></td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td><?php echo Kohana::lang('registers_lang.lbl_program_chucdanh')?></td>
    <td><input type="text" name="txt_chucdanh"  size="40"/></td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>Email</td>
    <td><input type="text" name="txt_email_congty"  size="40"/></td>
    <td>&nbsp;</td>
  </tr>
</table>

	</td></tr>
	<tr><td align="center"><input name="txt_submit" type="submit" value="<?php echo Kohana::lang('registers_lang.btn_register')?>" /></td></tr>
   <tr>
    <td  >
   

	</td>
 </tr>
 
</table>
</form>
<script language="javascript">
// Last updated 2006-02-21
function addRowToTable()
{
  var tbl = document.getElementById('tblSample');
  var lastRow = tbl.rows.length;
  // if there's no header row in the table, then iteration = lastRow + 1
  var iteration = lastRow;
  var row = tbl.insertRow(lastRow);
  
  // left cell
  var cellLeft = row.insertCell(0);
  var textNode = document.createTextNode(iteration);
  cellLeft.appendChild(textNode);
  
  // right cell
  var cellRight = row.insertCell(1);
  var el = document.createElement('input');
  el.type = 'text';
  el.name = 'txt_name[]' + iteration;
  el.id = 'txt_name[]' + iteration;
  el.size = 30;
  
  el.onkeypress = keyPressTest;
  cellRight.appendChild(el);
  
  // select cell
  var cellRightSel = row.insertCell(2);
  var sel = document.createElement('select');
  sel.name = 'selGender[]' + iteration;
  sel.options[0] = new Option('<?php echo Kohana::lang('registers_lang.lbl_male')?>', '<?php echo Kohana::lang('registers_lang.lbl_male')?>');
  sel.options[1] = new Option('<?php echo Kohana::lang('registers_lang.lbl_female')?>', '<?php echo Kohana::lang('registers_lang.lbl_female')?>');
  cellRightSel.appendChild(sel);
  
   // right cell
  var cellRight = row.insertCell(3);
  var el = document.createElement('input');
  el.type = 'text';
  el.name = 'txt_designation[]' + iteration;
  el.id = 'txt_designation[]' + iteration;
  el.size = 10;
  
  el.onkeypress = keyPressTest;
  cellRight.appendChild(el);
  
  // email
  var cellRight = row.insertCell(4);
  var el = document.createElement('input');
  el.type = 'text';
  el.name = 'txt_email[]' + iteration;
  el.id = 'txt_email[]' + iteration;
  el.size = 30;
  
  el.onkeypress = keyPressTest;
  cellRight.appendChild(el);
}
function keyPressTest(e, obj)
{
  var validateChkb = document.getElementById('chkValidateOnKeyPress');
  if (validateChkb.checked) {
    var displayObj = document.getElementById('spanOutput');
    var key;
    if(window.event) {
      key = window.event.keyCode; 
    }
    else if(e.which) {
      key = e.which;
    }
    var objId;
    if (obj != null) {
      objId = obj.id;
    } else {
      objId = this.id;
    }
    displayObj.innerHTML = objId + ' : ' + String.fromCharCode(key);
  }
}
function removeRowFromTable()
{
  var tbl = document.getElementById('tblSample');
  var lastRow = tbl.rows.length;
  if (lastRow > 2) tbl.deleteRow(lastRow - 1);
}
function openInNewWindow(frm)
{
  // open a blank window
  var aWindow = window.open('', 'TableAddRowNewWindow',
   'scrollbars=yes,menubar=yes,resizable=yes,toolbar=no,width=400,height=400');
   
  // set the target to the blank window
  frm.target = 'TableAddRowNewWindow';
  
  // submit
  frm.submit();
}
function validateRow(frm)
{
  var chkb = document.getElementById('chkValidate');
  if (chkb.checked) {
    var tbl = document.getElementById('tblSample');
    var lastRow = tbl.rows.length - 1;
    var i;
    for (i=1; i<=lastRow; i++) {
      var aRow = document.getElementById('txtRow' + i);
      if (aRow.value.length <= 0) {
        alert('Row ' + i + ' is empty');
        return;
      }
    }
  }
  openInNewWindow(frm);
}

</script>